package com.fancy.imasclient.client;

import cn.hutool.db.PageResult;
import com.fancy.common.dto.response.Result;
import com.fancy.imasclient.dto.FollowInfoDTO;
import com.fancy.imasclient.dto.FollowRequestDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient(name = "social-service",path = "/api/v1")
public interface SocialServiceClient {

    @GetMapping("/follows/{userId}/stats")
    Result<Map<String, Object>> getFollowStats(
            @PathVariable("userId") Long userId,
            @RequestHeader(value = "X-User-Id", required = false) Long currentUserId
    );

    @PostMapping("/users/{userId}/follow")
    Result<Void> followTarget(
            @PathVariable("userId") Long userId,
            @RequestBody FollowRequestDTO dto
    );

    @DeleteMapping("/users/{userId}/unfollow")
    Result<Void> unfollowTarget(
            @PathVariable("userId") Long userId,
            @RequestBody FollowRequestDTO dto
    );

    @GetMapping("/users/{userId}/following")
    Result<PageResult<FollowInfoDTO>> getFollowing(
            @PathVariable("userId") Long userId,
            @RequestParam("page") int page,
            @RequestParam("size") int size
    );

    @GetMapping("/users/{userId}/followers")
    Result<PageResult<FollowInfoDTO>> getFollowers(
            @PathVariable("userId") Long userId,
            @RequestParam("page") int page,
            @RequestParam("size") int size
    );
}

